cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
project(test-libtorch)
# 设置libtorch的位置
set(CMAKE_PREFIX_PATH "/root/miniconda3/lib/python3.8/site-packages/torch/share/cmake")
message(${CMAKE_PREFIX_PATH})
find_package(Torch REQUIRED)
# find_package(Opencv REQUIRED)
add_library(test-libtorch SHARED op.cpp)
# add_executable(test-libtorch op.cpp)

# #link libtorch .a .so
target_link_libraries(test-libtorch "${TORCH_LIBRARIES}")
#
set_property(TARGET test-libtorch PROPERTY CXX_STANDARD 14)